// 导入path 模块
const path = require('path')

// 定义文件路径
const fpath = './file/1.txt'
const fext = path.extname(fpath)

console.log(fext);// .txt